#include <stdio.h>
#include <string.h>
#include "bonc.h"

void swap(int *a, int *b)
{
	if(*a != *b)
	{
		int t=0;
		t = *a;
		*a = *b;
		*b = t;
	}
}

int main(int argc, char * argv[])
{
	int n;
	int m;
	int x1;
	int x2;
	int y1;
	int y2;
	int Grid[40][40];
	int i;
	int j;

	scanf("%d%d%d%d%d%d",&n,&m,&x1,&x2,&y1,&y2);
	if(x1 >= x2)
	{
		swap(&x1,&x2);
	}
	if(y1 >=y2)
	{
		swap(&y1,&y2);
	}
	memset(Grid,0,sizeof(Grid));
	for(i = x1; i <= n; i++)
	{
		for(j = y1; j <= m; j++)
		{
			if(i == x1 || j == y1)
			{
				Grid[i][j] == 1;
			}
			else 
			{
				Grid[i][j] = Grid[i-1][j] + Grid[i][j-1];
			}
		}
	}
	bonc_print_in("%d",Grid[i][j]);
}
